<?php
!defined("PHOTO_ADMIN") && exit("ACCESS DENIED");
if(empty($_POST['step'])){

	include atemplate("do_vmanage");
}else{
	$votenum = abs(intval($_POST['votenum']));
	if($votenum<=0){
		adminmessage("票数有误！");
	}

	$optype = intval($_POST['optype']);
	$type = intval($_POST['type']);

	if($optype==1){
		$votenum = -$votenum;
	}
	
	if($type>2){
		adminmessage("操作对象有误！");
	}

	if($type==1){
		$where = " WHERE id%2!=0";
	}else if($type==2){
		$where = " WHERE id%2=0";
	}

	$db->query("UPDATE ".tname('image')." SET votenum=votenum+$votenum $where");
//	if ($db->affected_rows()) {
		adminmessage("票数操作成功！","index.php?do=vmanage");
//	}else{
//		adminmessage("票数操作失败！");	
//	}

}
?>